﻿using EWS;
using Microsoft.Exchange.WebServices.Data;
using Quartz;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using XF.Meeting.Common;
using XF.Meeting.DAL;
using XF.Meeting.Entity.DTO;
using XF.Meeting.Entity.Query;

namespace QuartzJob.Jobs
{
    public class GetMeetByZhouqiFromExchange : IJob
    {
        ExchangeToDbDal dal = new ExchangeToDbDal();
        public  async System.Threading.Tasks.Task Execute(IJobExecutionContext context)
        {

            var service = ExChangeHelper.getExChangeHelper();
            var meetList = new List<Appointment>();
            //  ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true;
            var meetss = service.GetRoomLists();
            foreach (var meetRooms in meetss)
            {
                var meetRoom = service.GetRooms(meetRooms);
                foreach (var room in meetRoom)
                {
                    try
                    { 
                         var list =   ExChangeHelper.GetZhouqiEmailListByRoom(room.Address);
                      
                    }
                    catch (Exception e)
                    {

                        continue;
                    }
                  

                }

            }
        }
    } }
